import http from '../utils/request'

//商品总数量接口
export function productNumberRequest() {
  return http({
    url: '/admin/statistic/product',
    method: 'get',
  })
}
//商品列表接口
export interface listobjparams {
  count: number
  limitNum: number
  search: string
  category: string
} //封装商品列表接口函数
export interface Iproduct {
  proname: string
  proid: string
  stock: number
  sales: number
  originprice: number
  desc: string
  imgs: string[]
}
export const productListRequest = (listobj: listobjparams)=> {
  return http <IResData<Iproduct[]>>({
    url: '/admin/pro/list',
    method: 'get',
    params:listobj,
  })
}
//商品分类列表接口
export const productCateLIstRequest = () => {
  return http<IResData<string[]>>({
    url: '/admin/pro/getCategory',
    method: 'get',
  })
}
//发布商品接口
export const productAddRequest = (body: Iproduct) => {
  return http<IResData<string[]>>({
    url: '/admin/pro/product',
    method: 'post',
    data: body,
  })
}
